queue.cc route.cc waypt.cc filter_vecs.cc util.cc vecs.cc mkshort.cc
csv_util.cc strptime.c grtcirc.cc util_crc.cc xmlgeneric.cc
formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc
- inifile.cc garmin_fs.cc gbsleep.cc units.cc gbser.cc
+ inifile.cc garmin_fs.cc units.cc gbser.cc
gbfile.cc parse.cc session.cc main.cc globals.cc
src/core/usasciicodec.cc
src/core/xmlstreamwriter.cc
if(${HAVE_STDARG_H})
add_definitions(-DHAVE_STDARG_H)
endif()
- add_definitions(-DHAVE_NANOSLEEP -DHAVE_LIBUSB -DHAVE_GLOB)
+ add_definitions(-DHAVE_LIBUSB -DHAVE_GLOB)
set(SOURCES ${SOURCES} gbser_posix.cc)
set(HEADERS ${HEADERS} gbser_posix.h)
set(JEEPS ${JEEPS} jeeps/gpslibusb.cc)
SUPPORT = queue.cc route.cc waypt.cc filter_vecs.cc util.cc vecs.cc mkshort.cc \
csv_util.cc strptime.c grtcirc.cc util_crc.cc xmlgeneric.cc \
formspec.cc xmltag.cc cet.cc cet_util.cc fatal.cc rgbcolors.cc \
- inifile.cc garmin_fs.cc gbsleep.cc units.cc gbser.cc \
+ inifile.cc garmin_fs.cc units.cc gbser.cc \
gbfile.cc parse.cc session.cc main.cc globals.cc \
src/core/usasciicodec.cc \
src/core/xmlstreamwriter.cc
# this is used by zlib
DEFINES += HAVE_STDARG_H
}
- DEFINES += HAVE_NANOSLEEP HAVE_LIBUSB HAVE_GLOB
+ DEFINES += HAVE_LIBUSB HAVE_GLOB
SOURCES += gbser_posix.cc
HEADERS += gbser_posix.h
JEEPS += jeeps/gpslibusb.cc
LIBOBJS = queue.o route.o waypt.o filter_vecs.o util.o vecs.o mkshort.o \
csv_util.o strptime.o grtcirc.o util_crc.o xmlgeneric.o \
formspec.o xmltag.o cet.o cet_util.o fatal.o rgbcolors.o \
- inifile.o garmin_fs.o gbsleep.o units.o @GBSER@ gbser.o \
+ inifile.o garmin_fs.o units.o @GBSER@ gbser.o \
gbfile.o parse.o session.o \
src/core/xmlstreamwriter.o \
src/core/usasciicodec.o\
gbser_posix.o: gbser_posix.cc defs.h config.h queue.h zlib/zlib.h \
zlib/zconf.h gbfile.h cet.h inifile.h session.h src/core/datetime.h \
src/core/optional.h gbser.h gbser_private.h
-gbsleep.o: gbsleep.cc config.h
gdb.o: gdb.cc defs.h config.h queue.h zlib/zlib.h zlib/zconf.h gbfile.h \
cet.h inifile.h session.h src/core/datetime.h src/core/optional.h \
cet_util.h csv_util.h garmin_fs.h jeeps/gps.h jeeps/../defs.h \
/* 1 to enable all the filters. */
#undef FILTERS_ENABLED
-/* define if the compiler supports basic C++11 syntax */
-#undef HAVE_CXX11
+/* define if the compiler supports basic C++14 syntax */
+#undef HAVE_CXX14
/* Define to 1 if you have the `glob' function. */
#undef HAVE_GLOB
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have the `nanosleep' function. */
-#undef HAVE_NANOSLEEP
-
-/* Define to 1 if you have the `sleep' function. */
-#undef HAVE_SLEEP
-
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
# AC_FUNC_STRTOD
# AC_FUNC_VPRINTF
# AC_CHECK_FUNCS([atexit floor localtime_r memmove memset pow select sqrt strchr strcspn strdup strerror strncasecmp strrchr strspn strstr strtol strtoul])
-for ac_func in nanosleep sleep uname glob
+for ac_func in uname glob
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"
# AC_FUNC_STRTOD
# AC_FUNC_VPRINTF
# AC_CHECK_FUNCS([atexit floor localtime_r memmove memset pow select sqrt strchr strcspn strdup strerror strncasecmp strrchr strspn strstr strtol strtoul])
-AC_CHECK_FUNCS([nanosleep sleep uname glob])
+AC_CHECK_FUNCS([uname glob])
#
# There's probably some more "autoconfish" way to do this.
double fmt_altitude(const double, const char** tag);
double fmt_speed(const double, const char** tag);
-/*
- * From gbsleep.c
- */
-void gb_sleep(unsigned long microseconds);
-
/*
* From nmea.c
*/
#include "garmin_gpi.h"
#include "jeeps/gpsmath.h"
#include <QtCore/QTextCodec>
+#include <QtCore/QThread>
#include <cstdlib>
#define MYNAME "garmin_gpi"
}
gpi_timestamp += sleep;
while (gpi_timestamp > time(nullptr)) {
- gb_sleep(100);
+ QThread::usleep(100);
}
}
}
+++ /dev/null
-/*
- OS abstraction to sleep a given number of milliseconds.
-
- Copyright (C) 2006 Robert Lipe, robertlipe+source@gpsbabel.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
-
- */
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#if __WIN32__
-
-#include <windows.h>
-void
-gb_sleep(unsigned long microseconds)
-{
- Sleep(microseconds/1000 + 1);
-}
-
-#elif defined HAVE_NANOSLEEP
-
-#include <ctime>
-void
-gb_sleep(unsigned long microseconds)
-{
- struct timespec req;
- req.tv_sec = microseconds / 1000000;
- req.tv_nsec = (microseconds * 1000) % 1000000000;
- nanosleep(&req, nullptr);
-}
-#elif defined HAVE_SLEEP
-/* Amazingly underachieving, but probably "good enough" */
-#include <unistd.h>
-void
-gb_sleep(unsigned long microseconds)
-{
- sleep(microseconds / 1000000);
-}
-#endif
#include "gps.h"
#include "../gbser.h"
#include "gpsserial.h"
+#include <QtCore/QThread>
#include <cerrno>
#include <cstdio>
#include <ctime>
GPS_PPacket tra;
GPS_PPacket rec;
win_serial_data* wsd = (win_serial_data*)fd;
-
+
DWORD speed = mkspeed(br);
// Turn off all requests by transmitting packet
if (!GPS_Get_Ack(fd, &tra, &rec)) {
return gps_errno;
}
-
+
GPS_Util_Put_Int(data, br);
GPS_Make_Packet(&tra, 0x30, data, 4);
if (!GPS_Write_Packet(fd,tra)) {
}
GPS_Device_Flush(fd);
GPS_Device_Wait(fd);
-
+
// Sleep for a small amount of time, about 100 milliseconds,
// to make sure the packet was successfully transmitted to the GPS unit.
- gb_sleep(100000);
-
+ QThread::usleep(100000);
+
// Change port speed
DCB tio;
tio.DCBlength = sizeof(DCB);
if (!GPS_Get_Ack(fd, &tra, &rec)) {
return gps_errno;
}
-
+
if (global_opts.debug_level >= 1) fprintf(stderr, "Serial port speed set to %d\n", br);
return 0;
-
+
}
#else
static UC data[4];
GPS_PPacket tra;
GPS_PPacket rec;
-
+
speed_t speed = mkspeed(br);
// Turn off all requests by transmitting packet
if (!GPS_Get_Ack(fd, &tra, &rec)) {
return gps_errno;
}
-
+
GPS_Util_Put_Int(data, br);
GPS_Make_Packet(&tra, 0x30, data, 4);
if (!GPS_Write_Packet(fd,tra)) {
}
GPS_Device_Flush(fd);
GPS_Device_Wait(fd);
-
+
// Sleep for a small amount of time, about 100 milliseconds,
// to make sure the packet was successfully transmitted to the GPS unit.
- gb_sleep(100000);
-
+ QThread::usleep(100000);
+
// Change port speed
posix_serial_data* psd = (posix_serial_data*)fd;
tty = psd->gps_ttysave;
-
+
cfsetospeed(&tty,speed);
cfsetispeed(&tty,speed);
-
+
if (tcsetattr(psd->fd,TCSANOW|TCSAFLUSH,&tty)==-1) {
GPS_Serial_Error("SERIAL: tcsetattr error");
return 0;
}
-
+
GPS_Util_Put_Short(data, 0x3a);
GPS_Make_Packet(&tra, 0x0a, data, 2);
if (!GPS_Write_Packet(fd,tra)) {
if (!GPS_Get_Ack(fd, &tra, &rec)) {
return gps_errno;
}
-
+
if (global_opts.debug_level >= 1) fprintf(stderr, "Serial port speed set to %d\n", br);
return 0;
-
+
}
#endif /* __WIN32__ */
#include "gbser.h"
#include <QtCore/QDir>
#include <QtCore/QFile>
+#include <QtCore/QThread>
#include <cerrno>
#include <cmath>
#include <cstdlib>
dbg(1, "Start flash erase..\n");
do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", nullptr, 1);
- gb_sleep(10*1000);
+ QThread::usleep(10 * 1000);
// Erase log....
do_cmd(CMD_LOG_ERASE, "PMTK001,182,6", nullptr, 30);
- gb_sleep(100*1000);
+ QThread::usleep(100 * 1000);
if ((log_status & 2)) { // auto-log were enabled before..re-enable log.
int err = do_cmd(CMD_LOG_ENABLE, "PMTK001,182,4,3", nullptr, 2);
fusage = nullptr;
}
- gb_sleep(10*1000);
+ QThread::usleep(10 * 1000);
if (true || log_enabled) {
i = do_cmd(CMD_LOG_DISABLE, "PMTK001,182,5,3", nullptr, 2);
dbg(3, " ---- LOG DISABLE ---- %s\n", i==0?"Success":"Fail");
}
- gb_sleep(100*1000);
+ QThread::usleep(100 * 1000);
unsigned int addr_max = 0;
// get flash usage, current log address..cmd only works if log disabled.
if (line[15] != '3') {
// fixme - we should timeout here when no log data has been received...
dbg(2, "\nLog req. failed (%c)\n", line[15]);
- gb_sleep(10*1000);
+ QThread::usleep(10 * 1000);
retry_cnt++;
goto mtk_retry;
}
#include "gbser.h"
#include "jeeps/gpsmath.h"
#include "navilink.h"
+#include <QtCore/QThread>
#define MYNAME "NAVILINK"
data[6] = 0x00;
write_packet(PID_WRITE_TRACKPOINTS, data, sizeof(data));
- gb_sleep(10000);
+ QThread::usleep(10000);
write_packet(PID_DATA, track_data, track_data_ptr - track_data);
read_packet(PID_CMD_OK, nullptr, 0, 0, false);
* takes around 1 second. The total sectors for SBP is 10.
* So give the device some time to clear its datalog, in addition
* to SERIAL_TIMEOUT, which applies to read_packet() */
- gb_sleep(CLEAR_DATALOG_TIME * 1000);
+ QThread::usleep(CLEAR_DATALOG_TIME * 1000);
read_packet(PID_ACK, nullptr, 0, 0, false);
}
}
#include <ctime>
#include <QtCore/QStringList>
+#include <QtCore/QThread>
/**********************************************************
gbfprintf(file_out, "$%s*%02X\n", obuf, cksum);
if (sleepus >= 0) {
gbfflush(file_out);
- gb_sleep(sleepus);
+ QThread::usleep(sleepus);
}
}
static void
gbfflush(file_out);
if (last_time > 0) {
if (sleepus >= 0) {
- gb_sleep(sleepus);
+ QThread::usleep(sleepus);
} else {
long wait_time = wpt->GetCreationTime().toTime_t() - last_time;
if (wait_time > 0) {
- gb_sleep(wait_time * 1000000);
+ QThread::usleep(wait_time * 1000000);
}
}
}
pkt[27] = br & 0xff;
sirf_write(pkt);
- gb_sleep(250 * 1000);
+ QThread::usleep(250 * 1000);
gbser_flush(gbser_handle);
}
#include "defs.h"
#include "gbser.h"
+#include <QtCore/QThread>
#include <cmath>
#include <cstdio>
#include <cstdlib>
return res_ERROR;
}
- gb_sleep(50); /* allow UART to settle. */
+ QThread::usleep(50); /* allow UART to settle. */
return res_OK;
}
}
}
- gb_sleep(50); /* allow UART to settle. */
+ QThread::usleep(50); /* allow UART to settle. */
skytraq_wr_msg(MSG_QUERY_SOFTWARE_VERSION, /* get firmware version */
sizeof(MSG_QUERY_SOFTWARE_VERSION));